package com.woniu.park.controller;

import com.woniu.park.pojo.Common;
import com.woniu.park.service.CommonService;
import com.woniu.park.util.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 张洛诚
 * @date 2019/8/28 20:11:27
 * @description
 */
@RestController
@Api(tags = "公共组件")
public class CommonController {

    @Autowired
    CommonService commonService;

    @ApiOperation(value = "根据id查询公共组件",notes="根据id查询公共组件")
    @ApiImplicitParam(name = "commonId",value = "公共ID",required = true,dataType = "Integer",paramType = "path")
    @GetMapping("/getCommonById/{commonId}")
    public JsonResult<Common> getCommonById(@PathVariable("commonId") Integer commonId){
        Common common = commonService.getCommmonById(commonId);
        return new JsonResult<Common>(common);
    }
}
